<div class="border1">
    <button id="desktop" class="button" onclick="window.open('goldendict://{{单词}}', '_blank')">
        <div style="font-size: 12px; font-weight: bold; " accesskey="s">Dict</div>
        <i class="fa fa-book"></i>
    </button>
    <button id="android" class="button" onclick="window.open('eudic://dict//{{单词}}', '_blank')">
        <div style="font-size: 12px; font-weight: bold; ">Dict</div>
        <i class="fa fa-book"></i>
    </button>

    <button class="button" onclick="document.getElementById('audio').play()">
        <div style="font-weight: bold; font-size: 12px; ">Pron</div>
        <i class="fa fa-play">
            <audio id="audio" src="https://dict.youdao.com/dictvoice?audio={{单词}}&type=2" autoplay accesskey="a"></audio>
        </i>
    </button>

    <div class="xcolor" style="font-size: 24px">
        <span class="ximg"><img src="_space.png" height="24" width="36" /></span>
        Word
    </div>

    <div id="hint" class="word" style="font-size: 48px; font-weight: bold; ">
        {{单词}}
    </div>
</div>

{{#释义}}
<br />

<div class="border2">
    <div class="ycolor" style="font-size: 24px; ">
        <span class="yimg"><img src="_space.png" height="24" width="36" /></span>
        Definition
    </div>

    <div id="definition" class="explain" style="font-size: 32px; "></div>
</div>
{{/释义}}

{{#例句}}
<br />
<div class="border4">
    <div class="xcolor" style="font-size: 24px; ">
        <span class="ximg"><img src="_space.png" height="24" width="36" /></span>
        Example
    </div>

    <div id="example">
        {{例句}}
    </div>
</div>
{{/例句}}

{{#笔记}}
<br />

<div class="border3">
    <div class="zcolor" style="font-size: 24px">
        <span class="zimg"><img src="_space.png" height="24" width="36" /></span>
        Notes
    </div>

    <div style="font-size: 28px; ">
        {{笔记}}
    </div>
</div>
{{/笔记}}

<script>
    var word = "{{单词}}".trim()
    var definition = "{{#词性}}{{词性}}. {{/词性}}{{释义}}"
    formattedDefinition = definition.replace("<br>", "\n").replace(/(^(?:[a-z]+\.\/)*[a-z]+\.)/gm, '<i>$1</i>');
    document.getElementById("definition").innerHTML = formattedDefinition.replace("\n", "<br>");

    function addLineNumber(element) {
        let text = element.innerHTML;
        let lines = text.split("<br>");
        let numberedLines = lines.map((line, index) => `${index + 1}. ${line}`);
        element.innerHTML = numberedLines.join("<br>");
    }
    addLineNumber(document.getElementById("example"));
</script>

<script src="_Spell-Back.js"></script>

<script>
    if (navigator.userAgent.match(/(Android)/i)) {
        document.getElementById("desktop").style.display = "none"
    } else {
        document.getElementById("android").style.display = "none"
    }
</script>
